home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-01-25 | 3.1 KB | 85 lines | [TEXT/CWIE] |
- //========================================================================================
- //
- // Flat Movie.c - An export module to flatten QuickTime movies.
- //
- // Written by Randy Ubillos and Bryan K. "Beaker" Ressler.
- //
- // Copyright ⌐ 1993-96, Adobe Systems Incorporated, all rights reserved worldwide.
- //
- // Version 1.00 10/20/93 Original version
- // Version 1.01 9/12/94 Updated for 4.0
- // Version 1.02 10/8/95 Updated for 4.2 and CW7.
- //
- //========================================================================================
-
- //========================================================================================
- // Includes - use precompiled headers if compiling with CodeWarrior.
- //========================================================================================
- #ifdef __MWERKS__
- #ifdef powerc
- #include "PremierePPC"
- #else
- #include "Premiere68k"
- #endif
- #else
- #include "Premiere.h"
- #endif
-
- //========================================================================================
- // Constants
- //========================================================================================
- enum { // Resource IDs
- frStrings = 600 // STR# - our strings (including errors)
- };
-
- enum { // Strings in our STR#
- fsPrompt = 1, // Prompt for standard file
- fsSuffix, // Suffix to append to the end of the filename
- fsErrNotAMovie // Tried to export a clip that's not a QT movie
- };
-
- //========================================================================================
- // Export module entry point
- //========================================================================================
- pascal short main (short selector, DataExportHandle theData)
- {
- Str63 prompt, suffix, defaultName;
- StandardFileReply reply;
- FSSpec theSpec;
- Movie theMovie;
- short resID, result = 0;
-
- // Act according to the selector
- switch (selector) {
- case edExecute:
- // This export module only works with movies. GetExportMovie gets the movie
- // handle (if any) and returns it. If it's not a movie, it returns nil.
- theMovie = GetExportMovie(theData);
- if (theMovie != nil) {
- // Get the standard put file prompt from our string list, then get the
- // FSSpec for the clip we're flattening so we have a default name. Get the
- // ".flat" stuffix from the string list, too.
- GetIndString(prompt, frStrings, fsPrompt);
- GetExportFSSpec(theData, &theSpec);
- GetIndString(suffix, frStrings, fsSuffix);
-
- // Copy the clip name to the default save name. Append the suffix.
- BlockMove(theSpec.name, defaultName, theSpec.name[0] + 1);
- Append(defaultName, suffix);
-
- // Put up a standard put file dialog to get a new name from the user.
- StandardPutFile(prompt, defaultName, &reply);
- if (reply.sfGood) {
- // Call QuickTime to flatten the movie.
- resID = 0;
- theSpec = reply.sfFile;
- FlattenMovie(theMovie,
- flattenAddMovieToDataFork + flattenActiveTracksOnly, &theSpec,
- 'PrMr', 0, createMovieFileDeleteCurFile, &resID, nil);
- }
- } else AlertSystem(0, false, frStrings, fsErrNotAMovie, 0, 0);
- break;
- }
- return(result);
- }
-